/*
 * Classname ISSOObject.java
 * 
 * Version Information
 * Date Mar 21, 2006
 *
 * Copyright (c) AmSoft Systems, 2006
 */
package net.amsoft.iservice.isso.hibernate;

import java.util.Date;
import net.amsoft.iservice.isso.util.ISSOConstants;
import net.amsoft.iservice.util.exception.IServiceException;

public class ISSOObject {
    protected Long id;
    protected Date creationTime;
    protected Date modificationTime;
    protected short state;

    public Long getId() {
        return id;
    }
    private void setId(Long id) {
        this.id = id;
    }
    public Date getCreationTime() {
        return this.creationTime;
    }
    protected void setCreationTime(Date creationTime) {
        this.creationTime = creationTime;
    }
    public Date getModificationTime() {
        return this.modificationTime;
    }
    protected void setModificationTime(Date modificationTime) {
        this.modificationTime = modificationTime;
    }
    public short getState() {
        return state;
    }
    public void setState(short state) {
        this.state = state;
    }
    public ISSOObject insert() throws IServiceException {
        this.setCreationTime(new Date());
        this.setModificationTime(new Date());
        this.setState(state);
        return (this);
    }
    public ISSOObject update() {
        this.setModificationTime(new Date());
        return (this);
    }
    public ISSOObject remove() {
        this.setState((short) ISSOConstants.STATE_INACTIVE);
        return (this);
    }
}
